package com.csxh.eshop.dao;

import static org.junit.Assert.*;

import java.util.List;

import org.junit.Test;

import com.csxh.eshop.bean.Admin;

public class AdminDaoTest {

	@Test
	public void testFindById() {

		AdminDao dao = new AdminDaoJdbcImpl();
		
		Admin admin = dao.findById(1);

		assertNotNull(admin);
	}

	@Test
	public void testFindOne() {

	}

	@Test
	public void testFindAll() {

		AdminDao dao = new AdminDaoJdbcImpl();

		List<Admin> adminList = dao.findAll("`level`=?", "admin");

		assertNotNull(adminList);

	}
	
	@Test
	public void testSave() {
		Admin admin=new Admin();
		admin.setUsername("xxx");
		admin.setPassword("1234");
		admin.setLevel("editor");
		
		AdminDao dao=new AdminDaoJdbcImpl();
		boolean b=dao.save(admin);
		assertTrue(b);
	}

}
